/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       new_map_options_dialog.h

	$Header: /game/new_map_options_dialog.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef NEW_MAP_OPTIONS_DIALOG_H_INCLUDED
#define NEW_MAP_OPTIONS_DIALOG_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <vector>
#include "bitmap_group_ptr.h"
#include "button_ptr.h"
#include "game_window.h"
#include "player_color.h"
#include "player_setup.h"
#include "scrollbar_ptr.h"
#include "string_vector.h"
#include "text_window_ptr.h"
#include "toggle_button_ptr.h"

class	t_bitmap_layer;
class	t_bitmap_layer_window;
class	t_bitmap_group_window;
class	t_button;
enum	t_difficulty;
class	t_map_header;
class	t_text_edit_window;
class	t_toggle_button;

struct t_color_button_images
{
    t_bitmap_layer_window *    released_image_window;
    t_bitmap_layer_window *    pressed_image_window;
    t_bitmap_layer_window *    highlighted_image_window;
    t_bitmap_layer_window *    disabled_image_window;
};

// --------------------------------------------------------
// windows assocatied with a player's setup controls
// --------------------------------------------------------
struct t_player_setup_controls
{
	t_toggle_button*		human;
	t_bitmap_group_window*  alignment;
	t_button*				color_decrease;
	t_button*			    color_increase;
	t_bitmap_group_window*  color;
	t_button*				alignment_decrease;
	t_button*				alignment_increase;
    t_color_button_images	down_color_images;   
    t_color_button_images	up_color_images;   
	t_bitmap_group_window*  town_background;
	t_bitmap_layer_window*  alignment_color_window;
	t_bitmap_layer_window*  alignment_layer_window;
	t_bitmap_layer_window*  team_layer_window;
	t_bitmap_group_window*  team_window;
	t_bitmap_group_window*  team_id_window;
	t_bitmap_group_window*  town_foreground;
	t_bitmap_layer_window*	left_border;
	t_text_edit_window*		name;
	t_window*	            name_background;
	t_bitmap_layer_window*	bottom_border;
	t_bitmap_layer_window*	right_border;
	t_window*				window;
};

class t_new_map_options_dialog : public t_window
{
public:
	t_new_map_options_dialog( t_window* parent,	t_map_header const&	m_map_header );

	bool					get_guards_move() const;
	t_player_setup*         get_player_setup();
	t_difficulty            get_player_difficulty() const;
	int                     get_turn_duration() const; // in milliseconds, 0 = unlimited.
private:
	void            begin( t_button* button );
	void			cancel( t_button* button );
	void			change_alignment( t_button* button, int position, int delta );
	void			change_color( t_button* button, int position, int delta );
	void			create_controls();
	t_screen_point	find_location( std::string const& layer_name ) const;
	void			guard_clicked( t_button* button );
	void			human_checkbox_click( t_button* button, int row );
	void			options_decrease_difficulty( t_button* button );
	void			options_increase_difficulty( t_button* button );
	void			set_alignment( int row, t_town_type alignment );
	void			set_color( int row, t_player_color color );
	void			set_controls();
	void			set_difficulty( t_difficulty difficulty );
	void			set_human( int row, bool human );
	void			turn_duration_scrollbar_move ( t_scrollbar* scrollbar, int value );

	t_bitmap_group_ptr					m_arrow_bitmaps;
	t_bitmap_group_ptr					m_bitmaps;             // all images required for dialog
    t_window_ptr						m_background;          // overall background
	t_button_ptr						m_begin_button;        // start game
	t_button_ptr						m_difficulty_left_button;
	t_button_ptr						m_difficulty_right_button;
    std::vector<t_color_button_images*>	m_color_up_arrows_list;
    std::vector<t_color_button_images*>	m_color_down_arrows_list;
	t_difficulty						m_difficulty;          // AI difficulty
	t_bitmap_group_ptr					m_difficulty_bitmaps;  // images for difficulty icons
	t_bitmap_group_window*				m_difficulty_icon;
	t_text_window*						m_difficulty_title;
	t_text_window_ptr					m_end_condition;
	bool								m_guards_move;
	t_text_window*						m_guards_can_move_window;
	t_map_header const&					m_map_header;
	t_window_ptr						m_player_difficulty_box;
	t_string_vector						m_player_names;
	t_text_window_ptr					m_scenario_description;
	t_player_setup						m_setup[k_active_player_color_count];
	t_player_setup_controls				m_setup_controls[k_active_player_color_count];
	int									m_team_id_map[k_active_player_color_count];
	t_scrollbar_ptr						m_turn_duration_scrollbar; // scrollbar for turn duration.
	t_text_window_ptr					m_turn_duration_text;
	int									m_turn_duration_index;
};

inline bool t_new_map_options_dialog::get_guards_move() const
{
	return m_guards_move;
}

inline t_difficulty t_new_map_options_dialog::get_player_difficulty() const
{
    return m_difficulty;    
}

inline t_player_setup* t_new_map_options_dialog::get_player_setup()
{
	return m_setup;
}



#endif